package com.config;


import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class RabbitmqDirectConfig {


    /**
     * 创建扇形交换机
     * @return
     */
    @Bean
    public DirectExchange directExchange()
    {
        return new DirectExchange("directExchange");
    }

    /**
     * 创建队列1
     * @return
     */
    @Bean
    public Queue createQueue3()
    {
        return new Queue("directQueue1");
    }

    /**
     * 创建队列1
     * @return
     */
    @Bean
    public Queue createQueue4()
    {
        return new Queue("directQueue2");
    }

    @Bean
    public Binding  bind1()
    {
        return BindingBuilder.bind(createQueue3()).to(directExchange()).with("com.key.sunjob");
    }

    @Bean
    public Binding  bind2()
    {
        return BindingBuilder.bind(createQueue4()).to(directExchange()).with("com.key");
    }


}
